package guda.grape;


import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * Created by well on 15/3/17.
 */
public class Demo1TimeoutCommand implements Command {

    private Logger log = LoggerFactory.getLogger(Demo1TimeoutCommand.class);

    @Override
    public void exec(final TaskEvent taskEvent,TaskFuture taskFuture) {

        try {
            if (taskEvent == null) {
                log.error("超时检测任务－执行失败 event is null");
                return;
            }
            //处理具体的业务

            log.info("超时检查任务 执行成功 ,bizid=" + taskEvent.getBizId());

        } finally {
            taskFuture.finish();
        }
    }

    @Override
    public String getEventType() {
        return EventTypeEnum.DEMO1_TIMEOUT.name();
    }
}
